#include "guiplay.h"
#include <qmessagebox.h>
#include <QTimer>
#include <QPaintEvent>

guiPlay::guiPlay(QWidget *parent)
	: QWidget(parent)
{
	//QWidget *widget = new QWidget;
	HWND hWnd = (HWND)this->winId();
	//setCentralWidget(widget);

	// QMessageBox::information(this, "ege", "regg");




	drawer = new XCxcD3D11Drawer;
	drawer->setHeight(1000);
	drawer->setWidth(1000);
	setGeometry(0, 0, 1000, 1000);
	drawer->setHWND((HWND)hWnd);
	drawer->initializeD3D11App();
	drawer->initializeScene();

	setAttribute(Qt::WA_PaintOnScreen, true);
//	setAttribute(Qt::WA_NativeWindow, true);
//	QTimer* timer = new QTimer(this);
	//connect(timer, SIGNAL(timeout()), this, SLOT(update()));
}

guiPlay::~guiPlay()
{

}

void guiPlay::paintEvent(QPaintEvent *event)
{
	// event->ignore();
	drawer->draw();
	drawer->rotateY(0.01f);
	update();
//	event->ignore();
}
